# $Id$
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Tobias Kieslich <tobias@justdreams.de>

pkgname=gthumb
pkgver=3.4.5+1+geec2172e
pkgrel=3
pkgdesc="Image browser and viewer for the GNOME Desktop"
url="https://wiki.gnome.org/Apps/gthumb"
arch=(i686 x86_64)
license=(GPL)
depends=(dconf librsvg clutter-gtk gst-plugins-base-libs gsettings-desktop-schemas libwebp
         libsecret libsoup webkit2gtk json-glib)
makedepends=(intltool libchamplain exiv2 itstool brasero libraw liboauth docbook-xsl
             yelp-tools flex gnome-common git)
optdepends=('libraw: read RAW files'
            'exiv2: metadata support'
            'libchamplain: map viewer'
            'brasero: burn discs'
            'liboauth: web albums')
_commit=eec2172e3554ecdca40dfeb1b84f8d7fc322338e  # gthumb-3-4
source=("git+https://git.gnome.org/browse/gthumb#commit=$_commit"
        0001-Do-not-process-bitmap-thumbnails-with-invalid-color-.patch)
sha256sums=('SKIP'
            '9cdffadd2b2c21904a997b4ab4ef311c18a59dfa6a3b236570af7f1465a36c60')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname
  patch -Np1 -i ../0001-Do-not-process-bitmap-thumbnails-with-invalid-color-.patch
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --sysconfdir=/etc \
      --localstatedir=/var --disable-static \
      --enable-libchamplain
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
}
